{% include 'include/head.html' %}
<!-- Page Container START -->
            <div class="page-container">
                <!-- Content Wrapper START -->
                <div class="main-content">
                    <div class="page-header">
                        <h2 class="header-title">销售信息表</h2>

                    </div>
                    <div class="card">
                        <div class="card-body">
                            <h4>销售信息表</h4>
                            <div class="m-t-25">
                                <div class="form-group row">
                                    <form method="post">
                                    <div class="input-group mb-3 col">
                                        <div class="d-flex align-items-center">
                                            {% csrf_token %}
                                            <input type="text" data-date-format="yyyy-mm-dd" class="form-control datepicker-input" name="start" placeholder="开始日期" autocomplete="off">
                                            <span class="p-h-10">到</span>
                                            <input type="text" data-date-format="yyyy-mm-dd" class="form-control datepicker-input" name="end" placeholder="结束日期" autocomplete="off">
                                        </div>
                                    </div>
                                    <div class="col">
                                        <button class="btn btn-primary mb-2" id="sub">查询</button>
                                    </div>
                                    </form>
                                </div>
                                <div class="form-group row">
                                    <div class="input-group mb-3 col">
                                        <a href="/la/export/csv/salelist/">
                                            <button class="btn btn-primary" id="generate-excel">
                                                <span>导出全部明细</span>
                                            </button>
                                        </a>
                                    </div>
                                </div>
                                <br>
                                <table id="data-table" class="table">
                                    <thead>
                                        <tr>
                                            <th>款号</th>
                                            <th>数量</th>
                                            <th>价格</th>
                                            <th>单据时间</th>
                                            <th>单据编号</th>
                                            <th>关联单据编号</th>
                                            <th>收银员</th>
                                            <th>支付方式</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for item in re %}
                                        <tr>
                                            <td>{{ item.sku }}</td>
                                            <td>{{ item.num }}</td>
                                            <td>{{ item.price }}</td>
                                            <td>{{ item.time }}</td>
                                            <td>{{ item.pid }}</td>
                                            <td>{{ item.opid }}</td>
                                            <td>{{ item.syname.name }}</td>
                                            <td>{{ item.zffs.name }}</td>
                                        </tr>
                                        {% endfor %}
                                    </tbody>
                                    <tfoot>
                                        <tr>
                                            <th>款号</th>
                                            <th>数量</th>
                                            <th>价格</th>
                                            <th>单据时间</th>
                                            <th>单据编号</th>
                                            <th>关联单据编号</th>
                                            <th>收银员</th>
                                            <th>支付方式</th>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- Content Wrapper END -->
                {% csrf_token %}
                <!-- Footer START -->
                <footer class="footer">
                    <div class="footer-content">
                        <p class="m-b-0">Copyright © 2019 Theme_Nate. All rights reserved.</p>
                        <span>
                            <a href="" class="text-gray m-r-15">Term &amp; Conditions</a>
                            <a href="" class="text-gray">Privacy &amp; Policy</a>
                        </span>
                    </div>
                </footer>
                <!-- Footer END -->

            </div>
            <!-- Page Container END -->

        </div>
    </div>


    <!-- Core Vendors JS -->
    <script src="/static/assets/js/vendors.min.js"></script>

    <!-- page js -->
    <script src="/static/assets/vendors/datatables/jquery.dataTables.min.js"></script>
    <script src="/static/assets/vendors/datatables/dataTables.bootstrap.min.js"></script>
    <script src="/static/assets/js/pages/datatables.js"></script>
    <script src="/static/assets/vendors/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
    <!-- Core JS -->
    <script src="/static/assets/js/app.min.js"></script>

    <script type="text/javascript" src="/static/external/jszip.min.js"></script>
    <script type="text/javascript" src="/static/external/FileSaver.js"></script>
    <script type="text/javascript" src="/static/external/excel-gen.js"></script>
    <script type="text/javascript" src="/static/excel/tableExport.min.js"></script>
    <script>
        $(document).ready(function () {


    </script>
    <script>
        $(function() {
            $('.datepicker-input').datepicker(

            );
        })
        $(function() {
            $("#subs").click(function(){
                var start = $('#start').val();
                var end = $('#end').val();
                var csrf = $('[name="csrfmiddlewaretoken"]').val();
                $.ajax({
                type: "POST",
                data: {start : start,end : end,csrfmiddlewaretoken:csrf},
                dataType: "json",
                success:function (message) {
                    /**
                    re = JSON.parse(message)
                    $("#tb").html("");
                    $.each(re,function(i,val){
                        console.log(val.fields.sku);
                        var a = "<tr><td>"+val.fields.sku+"</td></tr>";
                        console.log(a);
                        $("#tb").append(a);
                    })
                    **/
                },
                error:function (message) {
                }
                });
            });
        });
    </script>
</body>

</html>